/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.com.domain;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "profesiones")
@NamedQueries({@NamedQuery(name = "Profesiones.findAll", query = "SELECT p FROM Profesiones p"), @NamedQuery(name = "Profesiones.findByPrProfesion", query = "SELECT p FROM Profesiones p WHERE p.prProfesion = :prProfesion"), @NamedQuery(name = "Profesiones.findByPrDescripcion", query = "SELECT p FROM Profesiones p WHERE p.prDescripcion = :prDescripcion")})
public class Profesiones implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(generator="profesionGen", strategy=GenerationType.SEQUENCE)
    @SequenceGenerator(name="profesionGen", sequenceName="profesiones_pr_profesion_seq")
    @Basic(optional = false)
    @Column(name = "pr_profesion")
    private Integer prProfesion;
    @Column(name = "pr_descripcion")
    private String prDescripcion;
    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "dnProfesion", fetch = FetchType.LAZY)
    private Set<Personas> personasSet;

    public Profesiones() {
    }

    public Profesiones(Integer prProfesion) {
        this.prProfesion = prProfesion;
    }

    public Integer getPrProfesion() {
        return prProfesion;
    }

    public void setPrProfesion(Integer prProfesion) {
        this.prProfesion = prProfesion;
    }

    public String getPrDescripcion() {
        return prDescripcion;
    }

    public void setPrDescripcion(String prDescripcion) {
        this.prDescripcion = prDescripcion;
    }

    public Set<Personas> getPersonasSet() {
        return personasSet;
    }

    public void setPersonasSet(Set<Personas> personasSet) {
        this.personasSet = personasSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (prProfesion != null ? prProfesion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Profesiones)) {
            return false;
        }
        Profesiones other = (Profesiones) object;
        if ((this.prProfesion == null && other.prProfesion != null) || (this.prProfesion != null && !this.prProfesion.equals(other.prProfesion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.domain.Profesiones[prProfesion=" + prProfesion + "]";
    }

}
